package com.breeze.networkproject.volley;

import com.android.volley.Response;
import com.android.volley.VolleyError;

public abstract class VolleyInterface {
    private Response.Listener<String> listener;
    private Response.ErrorListener errorListener;

    public VolleyInterface() {
        listener = new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                onSuccess(response);
            }
        };

        errorListener = new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                onError(error);
            }
        };
    }

    protected abstract void onSuccess(String response);

    protected abstract void onError(VolleyError error);


    public Response.Listener<String> getListener() {
        return listener;
    }

    public Response.ErrorListener getErrorListener() {
        return errorListener;
    }
}
